package com.dev.dream.exochatlockscreen;

import com.dev.dream.libs.preperences.DevDreamPreferenceManager;

import android.content.Context;

public class EXOChatKeypadPreferences {
	// Handle for the LiveWallpaperPreferences singleton instance
	private static EXOChatKeypadPreferences INSTANCE;

	public static final int HANDLER_FINISH = 1;
	public static final int VIBRATE = 2;
	public static final int UNLOCK = 3;
	public static final int VISIBLE = 4;

	public static final String KEY_INDEX_BG = "KEY_INDEX_BG";
	public static final int DEFAULT_INDEX_BG = 1;

	public static final String KEY_TOUCH_EFFECT = "KEY_TOUCH_EFFECT";
	public static final boolean DEFAULT_TOUCH_EFFECT = true;

	public static final String KEY_SAVE_MODE = "KEY_SAVE_MODE";
	public static final boolean DEFAULT_SAVE_MODE = false;

	public static final String KEY_MOVE_BG = "KEY_MOVE_BG";
	public static final boolean DEFAULT_MOVE_BG = true;

	// String containing the live wallpaper's preferences name
	public static final String PREFERENCE_NAME = "dev.dream.exochatlockscreen";

	public static final String KEY_GUIDE = "SHOW_GUIDE";
	private static final boolean DEFAULT_GUIDE = false;

	public static final String KEY_ENABLE_LOCKSCREEN = "ENABLE_LOCKSCREEN";
	private static final boolean DEFAULT_ENABLE_LOCK = true;

	public static final String KEY_TIME_FORMAT = "KEY_TIME_FORMAT";
	private static final int DEFAULT_TIME_FORMAT = 0;

	public static final String KEY_FLASHLIGHT = "FLASHLIGHT";
	private static final boolean DEFAULT_FLASHLIGHT = false;

	public static final String KEY_DISPLAYDATE = "KEY_DISPLAY_DATE";
	private static final boolean DEFAULT_DISPLAYDATE = true;

	public static final String KEY_DISPLAYTIME = "KEY_DISPLAY_TIME";
	private static final boolean DEFAULT_DISPLAYTIME = true;

	public static final String KEY_SOUND_UNLOCK = "KEY_SOUND_UNLOCK";
	private static final boolean DEFAULT_SOUND_UNLOCK = true;

	public static final String KEY_VIBRATOR = "KEY_VIBRATOR";
	private static final boolean DEFAULT_VIBRATOR = true;

	public static final String KEY_ENABLE_TOOLBAR = "KEY_ENABLE_TOOLBAR";
	private static final boolean DEFAULT_TOOLBAR = true;

	public static final String KEY_ICON_TOOLBAR = "KEY_ICON_TOOLBAR";
	private static final boolean DEFAULT_ICON_TOOLBAR = true;

	public static final String KEY_ENABLE_PASSCODE = "KEY_ENABLE_PASSCODE";
	private static final boolean DEFAULT_ENBALE_PASSCODE = false;

	public static final String KEY_VALUE_PASSCODE = "KEY_VALUE_PASSCODE";
	private static final String DEFAULT_VALUE_PASSCODE = "";

	public static final String KEY_NOTIFI_SMS = "KEY_NOTIFI_SMS";
	private static final boolean DEFAULT_NOTIFI_SMS = true;

	public static final String KEY_NOTIFI_MISS_CALL = "KEY_NOTIFI_MISS_CALL";
	private static final boolean DEFAULT_NOTIFI_MISS_CALL = true;

	public static final String KEY_PATH_SOUND_UNLOCK = "KEY_PATH_SOUND_UNLOCK";
	private static final int DEFAULT_PATH_SOUND_UNLOCK = 1;

	public static final String KEY_RANDOM_BG = "KEY_RANDOM_BG";
	private static final boolean DEFAULT_RANDOM_BG = false;

	public static final String KEY_ICON_EXO = "KEY_ICON_EXO";
	private static final int DEFAULT_ICON_EXO = 1;

	public static final String KEY_FIRST = "KEY_FIRST";
	private static final boolean DEFAULT_FIRST = true;
	
	public static final String KEY_SEND_MSG = "KEY_SEND_MSG";
	private static final boolean DEFAULT_SEND_MSG = false;
	
	public static final String KEY_URL_MY_AVATAR = "KEY_URL_MY_AVATAR";
	public static final String DEFAULT_URL_MY_AVATAR = "DEFAULT";
	
	public static final String KEY_TEXT_SEND_MSG = "KEY_TEXT_SEND_MSG";
	public static final String DEFAULT_TEXT_SEND_MSG = "I LOVE YOU, EXO! \ue569";
	
	public static final String KEY_HIDE_CONTENT_SMS = "KEY_HIDE_CONTENT_SMS";
	private static final boolean DEFAULT_HIDE_CONTENT_SMS = false;

	public static final int size_icon = 36;
	public static final int size_bg = 36;
	// Shared preference values

	private boolean isShowGuid, enableLockscreen;
	private int timeFormat;
	private boolean flashlight;
	private int imgIndexBg;
	private boolean isDisplayDate, isDisplayTime;
	private boolean isSound, isVibrator;
	private boolean isToolbar, isIconToolbar;
	private boolean isEnablePasscode;
	private String valuePasscode;
	private boolean enableEffect, enableSaveMode, enableMoveBg;
	private boolean enableSMS, enableMissCall;
	private int indexSound = 1;
	private boolean randomBg;
	private int iconExo = 1;
	private boolean isFirst = true;
	private boolean isSendMsg = false;
	private String urlMyAvatar;
	private String textSendMsg;
	private boolean isHideContentSms;

	EXOChatKeypadPreferences() {
		// Do nothing...
	}

	// Obtain the LiveWallpaperPreferences instance
	public static EXOChatKeypadPreferences getInstance() {
		if (INSTANCE == null) {
			INSTANCE = new EXOChatKeypadPreferences();
		}
		return INSTANCE;
	}

	DevDreamPreferenceManager exoChatPreferenceManager;

	// Initialize the wallpaper's preference file
	public void initPreferences(Context pContext) {

		exoChatPreferenceManager = new DevDreamPreferenceManager(pContext,
				PREFERENCE_NAME);

		isShowGuid = exoChatPreferenceManager.getBoolean(KEY_GUIDE,
				DEFAULT_GUIDE);

		enableLockscreen = exoChatPreferenceManager.getBoolean(
				KEY_ENABLE_LOCKSCREEN, DEFAULT_ENABLE_LOCK);

		timeFormat = exoChatPreferenceManager.getInt(KEY_TIME_FORMAT,
				DEFAULT_TIME_FORMAT);

		flashlight = exoChatPreferenceManager.getBoolean(KEY_FLASHLIGHT,
				DEFAULT_FLASHLIGHT);

		imgIndexBg = exoChatPreferenceManager.getInt(KEY_INDEX_BG,
				DEFAULT_INDEX_BG);

		isDisplayDate = exoChatPreferenceManager.getBoolean(KEY_DISPLAYDATE,
				DEFAULT_DISPLAYDATE);

		isDisplayTime = exoChatPreferenceManager.getBoolean(KEY_DISPLAYTIME,
				DEFAULT_DISPLAYTIME);
		isSound = exoChatPreferenceManager.getBoolean(KEY_SOUND_UNLOCK,
				DEFAULT_SOUND_UNLOCK);
		isVibrator = exoChatPreferenceManager.getBoolean(KEY_VIBRATOR,
				DEFAULT_VIBRATOR);

		isToolbar = exoChatPreferenceManager.getBoolean(KEY_ENABLE_TOOLBAR,
				DEFAULT_TOOLBAR);

		isIconToolbar = exoChatPreferenceManager.getBoolean(KEY_ICON_TOOLBAR,
				DEFAULT_ICON_TOOLBAR);

		isEnablePasscode = exoChatPreferenceManager.getBoolean(
				KEY_ENABLE_PASSCODE, DEFAULT_ENBALE_PASSCODE);

		valuePasscode = exoChatPreferenceManager.getString(KEY_VALUE_PASSCODE,
				DEFAULT_VALUE_PASSCODE);

		enableEffect = exoChatPreferenceManager.getBoolean(KEY_TOUCH_EFFECT,
				DEFAULT_TOUCH_EFFECT);
		enableSaveMode = exoChatPreferenceManager.getBoolean(KEY_SAVE_MODE,
				DEFAULT_SAVE_MODE);

		enableMoveBg = exoChatPreferenceManager.getBoolean(KEY_MOVE_BG,
				DEFAULT_MOVE_BG);

		enableSMS = exoChatPreferenceManager.getBoolean(KEY_NOTIFI_SMS,
				DEFAULT_NOTIFI_SMS);

		enableMissCall = exoChatPreferenceManager.getBoolean(
				KEY_NOTIFI_MISS_CALL, DEFAULT_NOTIFI_MISS_CALL);

		indexSound = exoChatPreferenceManager.getInt(KEY_PATH_SOUND_UNLOCK,
				DEFAULT_PATH_SOUND_UNLOCK);

		randomBg = exoChatPreferenceManager.getBoolean(KEY_RANDOM_BG,
				DEFAULT_RANDOM_BG);

		iconExo = exoChatPreferenceManager.getInt(KEY_ICON_EXO,
				DEFAULT_ICON_EXO);
		
		isFirst = exoChatPreferenceManager.getBoolean(KEY_FIRST,
				DEFAULT_FIRST);
		
		isSendMsg = exoChatPreferenceManager.getBoolean(KEY_SEND_MSG,
				DEFAULT_SEND_MSG);
		
		urlMyAvatar = exoChatPreferenceManager.getString(KEY_URL_MY_AVATAR,
				DEFAULT_URL_MY_AVATAR);
		

		textSendMsg = exoChatPreferenceManager.getString(KEY_TEXT_SEND_MSG,
				DEFAULT_TEXT_SEND_MSG);
		
		isHideContentSms = exoChatPreferenceManager.getBoolean(KEY_HIDE_CONTENT_SMS,
				DEFAULT_HIDE_CONTENT_SMS);

	}

	public boolean isShowGuid() {
		return isShowGuid;
	}

	public void setShowGuid(boolean isShowGuid) {
		this.isShowGuid = isShowGuid;
		exoChatPreferenceManager.putBoolean(KEY_GUIDE, this.isShowGuid);

	}

	public boolean isEnableLockscreen() {
		return enableLockscreen;
	}

	public void setEnableLockscreen(boolean enableLockscreen) {
		this.enableLockscreen = enableLockscreen;
		exoChatPreferenceManager.putBoolean(KEY_ENABLE_LOCKSCREEN,
				this.enableLockscreen);

	}

	public int getTimeFormat() {
		return timeFormat;
	}

	public void setTimeFormat(int timeFormat) {
		this.timeFormat = timeFormat;
		exoChatPreferenceManager.putInt(KEY_TIME_FORMAT, this.timeFormat);

	}

	public boolean isFlashlight() {
		return flashlight;
	}

	public void setFlashlight(boolean flashlight) {
		this.flashlight = flashlight;
		this.exoChatPreferenceManager.putBoolean(KEY_FLASHLIGHT, flashlight);

	}

	public int getImgIndexBg() {
		return imgIndexBg;
	}

	public void setImgIndexBg(int imgIndexBg) {
		this.imgIndexBg = imgIndexBg;
		this.exoChatPreferenceManager.putInt(KEY_INDEX_BG, this.imgIndexBg);
	}

	public boolean isDisplayDate() {
		return isDisplayDate;
	}

	public void setDisplayDate(boolean isDisplayDate) {
		this.isDisplayDate = isDisplayDate;
		this.exoChatPreferenceManager.putBoolean(KEY_DISPLAYDATE,
				isDisplayDate);
	}

	public boolean isDisplayTime() {
		return isDisplayTime;
	}

	public void setDisplayTime(boolean isDisplayTime) {
		this.isDisplayTime = isDisplayTime;
		this.exoChatPreferenceManager.putBoolean(KEY_DISPLAYTIME,
				isDisplayTime);
	}

	public boolean isSound() {
		return isSound;
	}

	public void setSound(boolean isSound) {
		this.isSound = isSound;
		this.exoChatPreferenceManager.putBoolean(KEY_SOUND_UNLOCK, isSound);
	}

	public boolean isVibrator() {
		return isVibrator;
	}

	public void setVibrator(boolean isVibrator) {
		this.isVibrator = isVibrator;
		this.exoChatPreferenceManager.putBoolean(KEY_VIBRATOR, isVibrator);
	}

	public boolean isToolbar() {
		return isToolbar;
	}

	public void setToolbar(boolean isToolbar) {
		this.isToolbar = isToolbar;
		this.exoChatPreferenceManager
				.putBoolean(KEY_ENABLE_TOOLBAR, isToolbar);
	}

	public boolean isIconToolbar() {
		return isIconToolbar;
	}

	public void setIconToolbar(boolean isIconToolbar) {
		this.isIconToolbar = isIconToolbar;
		this.exoChatPreferenceManager.putBoolean(KEY_ICON_TOOLBAR,
				isIconToolbar);
	}

	public boolean isEnablePasscode() {
		return isEnablePasscode;
	}

	public void setEnablePasscode(boolean isEnablePasscode) {
		this.isEnablePasscode = isEnablePasscode;
		this.exoChatPreferenceManager.putBoolean(KEY_ENABLE_PASSCODE,
				isEnablePasscode);
	}

	public String getValuePasscode() {
		return valuePasscode;
	}

	public void setValuePasscode(String valuePasscode) {
		this.valuePasscode = valuePasscode;
		this.exoChatPreferenceManager.putString(KEY_VALUE_PASSCODE,
				valuePasscode);
	}

	public boolean isEnableEffect() {
		return enableEffect;
	}

	public void setEnableEffect(boolean enableEffect) {
		this.enableEffect = enableEffect;
		this.exoChatPreferenceManager.putBoolean(KEY_TOUCH_EFFECT,
				enableEffect);
	}

	public boolean isEnableSaveMode() {
		return enableSaveMode;
	}

	public void setEnableSaveMode(boolean enableSaveMode) {
		this.enableSaveMode = enableSaveMode;
		this.exoChatPreferenceManager
				.putBoolean(KEY_SAVE_MODE, enableSaveMode);
	}

	public boolean isEnableMoveBg() {
		return enableMoveBg;
	}

	public void setEnableMoveBg(boolean enableMoveBg) {
		this.enableMoveBg = enableMoveBg;
		this.exoChatPreferenceManager.putBoolean(KEY_MOVE_BG, enableMoveBg);
	}

	public boolean isEnableSMS() {
		return enableSMS;
	}

	public void setEnableSMS(boolean enableSMS) {
		this.enableSMS = enableSMS;
		this.exoChatPreferenceManager.putBoolean(KEY_NOTIFI_SMS, enableSMS);
	}

	public boolean isEnableMissCall() {
		return enableMissCall;
	}

	public void setEnableMissCall(boolean enableMissCall) {
		this.enableMissCall = enableMissCall;
		this.exoChatPreferenceManager.putBoolean(KEY_NOTIFI_MISS_CALL,
				enableMissCall);
	}

	public int getIndexSound() {
		return indexSound;
	}

	public void setIndexSound(int indexSound) {
		this.indexSound = indexSound;
		this.exoChatPreferenceManager
				.putInt(KEY_PATH_SOUND_UNLOCK, indexSound);
	}

	public boolean isRandomBg() {
		return randomBg;
	}

	public void setRandomBg(boolean randomBg) {
		this.randomBg = randomBg;
		this.exoChatPreferenceManager.putBoolean(KEY_RANDOM_BG, randomBg);
	}

	public int getIconExo() {
		return iconExo;
	}

	public void setIconExo(int iconExo) {
		this.iconExo = iconExo;
		this.exoChatPreferenceManager.putInt(KEY_ICON_EXO, iconExo);
	}

	public boolean isFirst() {
		return isFirst;
	}

	public void setFirst(boolean isFirst) {
		this.isFirst = isFirst;
		this.exoChatPreferenceManager.putBoolean(KEY_FIRST, isFirst);
	}

	public boolean isSendMsg() {
		return isSendMsg;
	}

	public void setSendMsg(boolean isSendMsg) {
		this.isSendMsg = isSendMsg;
		this.exoChatPreferenceManager.putBoolean(KEY_SEND_MSG, isSendMsg);
	}

	public String getUrlMyAvatar() {
		return urlMyAvatar;
	}

	public void setUrlMyAvatar(String urlMyAvatar) {
		this.urlMyAvatar = urlMyAvatar;
		this.exoChatPreferenceManager.putString(KEY_URL_MY_AVATAR, urlMyAvatar);
	}

	public String getTextSendMsg() {
		return textSendMsg;
	}

	public void setTextSendMsg(String textSendMsg) {
		this.textSendMsg = textSendMsg;
		this.exoChatPreferenceManager.putString(KEY_TEXT_SEND_MSG, textSendMsg);
	}

	public boolean isHideContentSms() {
		return isHideContentSms;
	}

	public void setHideContentSms(boolean isHideContentSms) {
		this.isHideContentSms = isHideContentSms;
		this.exoChatPreferenceManager.putBoolean(KEY_HIDE_CONTENT_SMS, isHideContentSms);
	}
	
	

}
